package com.company.strategy.type3;

/**
 * 上下文角色，游戏角色，比如：国王、将军、士兵
 * 每个角色可以随意切换武器(即策略)
 */
public abstract class Role {
    private WeaponStrategy weaponStrategy;

    public abstract void display();

    public void performFight() {
        weaponStrategy.fight();
    }

    /**
     * 设置武器
     * @param weaponStrategy
     */
    public void setWeaponStrategy(WeaponStrategy weaponStrategy) {
        this.weaponStrategy = weaponStrategy;
    }
}
